/*
 *    Copyright (c) 2018-2025, cloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cloud
 */

package com.fuyao.cloud.asset.purchaseApply.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuyao.cloud.asset.dto.apply.PurchaseapplyCreateDTO;
import com.fuyao.cloud.asset.dto.apply.PurchaseapplyEditDTO;
import com.fuyao.cloud.asset.dto.apply.PurchaseapplySearchDTO;
import com.fuyao.cloud.asset.entity.AssetPurchaseapply;
import com.fuyao.cloud.asset.entity.AssetPurchaseorderList;
import com.fuyao.cloud.asset.entity.ac.AssetAcList;
import com.fuyao.cloud.asset.vo.FyAssetPurchaseapplyExcelVO;
import com.fuyao.cloud.asset.vo.apply.PurchaseapplyPageVO;
import com.fuyao.cloud.common.core.util.R;
import com.fuyao.cloud.common.data.datascope.DataScope;

import java.util.List;

/**
 * 采购申请
 *
 * @author 时间的朋友
 * @date 2021-11-22 13:58:37
 */
public interface AssetPurchaseapplyService extends IService<AssetPurchaseapply> {

	/**
	 * 自定义导出
	 *
	 * @return
	 */
	List<FyAssetPurchaseapplyExcelVO> listExcel(QueryWrapper queryWrapper);

	/**
	 * 创建采购申请单
	 *
	 * @return 采购订单对象
	 */
	PurchaseapplyCreateDTO create();

	/**
	 * 编辑方法
	 *
	 * @param id 主键id
	 * @return 采购订单对象
	 */
	PurchaseapplyEditDTO edit(Long id);


	/**
	 * 重写采购申请分页方法
	 *
	 * @param page      分页对象
	 * @param query     条件构造器
	 * @param searchDTO 查询参数对象
	 * @return
	 */
	IPage<AssetPurchaseapply> page(Page page, QueryWrapper<AssetPurchaseapply> query, PurchaseapplySearchDTO searchDTO, DataScope dataScope);


	/**
	 * 采购申请信息
	 *
	 * @param page   分页对象
	 * @param query  查询构造器
	 * @param entity 采购申请对象
	 * @return 分页对象
	 */
	IPage<PurchaseapplyPageVO> getApplyPage(Page page, QueryWrapper<AssetPurchaseapply> query, AssetPurchaseapply entity);

	/**
	 * 根据批次号更新采购数量
	 *
	 * @param purchaseorderList 采购主单清单
	 * @param batchnumber       批次号
	 */
	void updatePurchasedQuantity(List<AssetPurchaseorderList> purchaseorderList, String batchnumber);

	/**
	 * 验收时更新采购申请已收货数量
	 *
	 * @param acList      验收清单
	 * @param batchnumber 批次号
	 */
	void updateArrivedQuantity(List<AssetAcList> acList, String batchnumber);

    String commit(AssetPurchaseapply purchaseapply);

	R batchDelete(List<Long> ids);
}
